package com.myway.front.service.impl;

import com.myway.front.dao.MyTabMemberInfoMapper;
import com.myway.front.dao.TabMemberInfoMapper;
import com.myway.front.pojo.TabMemberInfo;
import com.myway.front.service.MemberService;
import com.myway.front.util.IDUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class MemberServiceImpl implements MemberService {
    @Autowired
    private TabMemberInfoMapper tabMemberInfoMapper;
    @Autowired
    private MyTabMemberInfoMapper myTabMemberInfoMapper;
    @Override
    public String addMember(TabMemberInfo tabMemberInfo) {
        tabMemberInfo.setMembId(IDUtils.genItemId());
        tabMemberInfoMapper.insert(tabMemberInfo);
        return null;
    }

    @Override
    public String membLogin(String membPhoneNum, String membPwd) {
        Map map = new HashMap();
        map.put("membPhoneNum",membPhoneNum);
        map.put("membPwd",membPwd);
        List<TabMemberInfo> list =  myTabMemberInfoMapper.selectMembLogin(map);
        if(list.isEmpty()){
            return "login";
        }else{
            return "hotel";
        }

    }
}
